/*
 * @Author: yangzonglong
 * @Date: 2021-07-20 10:51:25
 * @version: v1.0.0
 * @Descripttion: mobile radio
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-08-30 16:06:45
 * @Auditor:
 */
import React, { useMemo } from 'react';
import PrintItem from './../PrintItem';

const App = (props) => {
  const { radioProps, formItemProps, initialValue } = props;

  const value = useMemo(() => {
    if (radioProps?.dataSource && initialValue) {
      const res = radioProps.dataSource.filter(item => item.value === initialValue);
      return res?.[0]?.['label'] || '';
    }
    return '';
  }, [radioProps, initialValue]);

  return (
    <PrintItem
      style={formItemProps?.style || {}}
      label={localStorage.i18nextLng === 'en' ? formItemProps?.labelEn : formItemProps?.label}>
      {value}
    </PrintItem>
  );
};

export default App;
